Streaming Notification event  is not raising for Sent Items folder

Hi All,

I am implementing a streaming notification technique in Email client application. For Inbox folder any new email arrives it is raising the event. But for Sent Items folder notification event not firing.

Below is the code snippet.

For Inbox:

StreamingSubscription streamingSubscription = service.SubscribeToStreamingNotifications(new FolderId[] { WellKnownFolderName.Inbox },EventType.NewMail);

connection.AddSubscription(streamingSubscription);
        connection.OnNotificationEvent += connection_OnNotificationEvent;
        connection.OnDisconnect += connection_OnDisconnect;
        connection.Open();

void connection_OnNotificationEvent(object sender, NotificationEventArgs args)
{

var newMails = from e in args.Events.OfType<ItemEvent>()
                               where e.EventType == EventType.NewMail || e.EventType== EventType.Created
                               select e.ItemId;

}

For Sent Items:

treamingSubscription streamingSubscription = service.SubscribeToStreamingNotifications(new FolderId[] { WellKnownFolderName.SentItems},EventType.Created);

connection.AddSubscription(streamingSubscription);
        connection.OnNotificationEvent += connection_OnNotificationEvent;
        connection.OnDisconnect += connection_OnDisconnect;
        connection.Open();

void connection_OnNotificationEvent(object sender, NotificationEventArgs args)
{

var newMails = from e in args.Events.OfType<ItemEvent>()
                               where e.EventType == EventType.NewMail || e.EventType== EventType.Created
                               select e.ItemId;

}

Thanks

Naresh


May 13th, 2015 8:26am

I would suggest you also listen for the MoveEvent on the Sent Items folder, some clients save a drafts first (which will cause a created in the drafts folder) and then the Item is moved to the Sent Items folder. The behaviour differs between different clients  so you should test with each client I'd suggest you also test it using the EWSEditor https://ewseditor.codeplex.com/ this will tell which notifications are firing.

Cheers
Glen

Free Windows Admin Tool Kit Click here and download it now
May 13th, 2015 10:31pm

Thank you very much Glen. For Sent items folder, Notification Event is raising for Event Type Moved.(if we send mail from outlook)
May 14th, 2015 1:50am

I would suggest you also listen for the MoveEvent on the Sent Items folder, some clients save a drafts first (which will cause a created in the drafts folder) and then the Item is moved to the Sent Items folder. The behaviour differs between different clients  so you should test with each client I'd suggest you also test it using the EWSEditor https://ewseditor.codeplex.com/ this will tell which notifications are firing.

Cheers
Glen

Free Windows Admin Tool Kit Click here and download it now
May 14th, 2015 2:25am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics